
<!DOCTYPE html>
<html lang="en">
<link th:href="@{/assets/css/bootstrap.min.css}" rel="stylesheet" />
<link rel="stylesheet" th:href="@{/assets/css/font-awesome.min.css}" />
<link rel="stylesheet" th:href="@{/assets/css/font-awesome-ie7.min.css}" />
<link rel="stylesheet" th:href="@{/assets/css/jquery-ui-1.10.3.custom.min.css}" />
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}" />
<link th:href="@{/assets/css/ace.min.css}" rel="stylesheet" type="text/css"/>
<link th:href="@{/assets/css/ace-rtl.min.css}" rel="stylesheet" type="text/css"/>
<link th:href="@{/assets/css/ace-skins.min.css}" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" th:href="@{/My97DatePicker/skin/WdatePicker.css}"/>
<link rel="stylesheet" th:href="@{/assets/css/chosen.css}" />
<head th:include="fragments/head::header" />
<style>
	.error {
		color: #F00
	}

</style>
<body>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
	<div class="main-container-inner">
		<div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
		<div class="main-content">
			<div class="breadcrumbs" id="breadcrumbs">
				<ul class="breadcrumb">
					<li><i class="icon-home home-icon"></i>首页</li>
					<li>佣金系统</li>
					<li>佣金系统添加</li>
				</ul>
			</div>
			<form method="post" id="edit">
				<div class="panel panel-default">
					<!-- Default panel contents -->
					<div class="panel-heading" style="background-color:#6fb3e0"><span  style="margin-left:45% ">学生基本信息</span></div>
					<!-- List group -->
					<ul class="list-group BasicInformation">
						<li class="list-group-item">
							<div class="row">
								<input type="text" id="studentNoString" th:value="${studentNos}" style="display: none"/>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">姓名</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="studentName" name="studentName"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">拼音</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="spelling" name="spelling"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">出生日期</span>
									<input class="form-control" placeholder=" " aria-describedby="basic-addon1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" th:name="birthday" id="birthday"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon" >获签日期</span>
									<input class="form-control" placeholder=" " aria-describedby="basic-addon1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" th:name="visaDate" id="visaDate"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon" >澳际学号</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="studentNo" name="studentNo"/>
								</div>

								<div class="input-group col-lg-3">
									<span class="input-group-addon">合同类型</span>
									<!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
									<select type="text" class="form-control" aria-describedby="basic-addon1" id="contractType" name="contractType">
										<option value="0">请选择</option>
										<option value="1">全程合同</option>
										<option value="2">单申请合同</option>
										<option value="3">单文书合同</option>
										<option value="4">单签证学校合同</option>
										<option value="5">预科合同</option>
									</select>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon" >代理推荐</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="agentType" id="agentType">
										<option value="0" selected="selected">请选择</option>
										<option value="1">与代理直接签约</option>
										<option value="2">通过代理与澳际签约</option>
									</select>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">登记日期</span>
									<input class="form-control" placeholder=" " aria-describedby="basic-addon1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" th:name="coeDate" id="coeDate" />
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon" >澳洲代理</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="ausAgentId" id="ausAgentId" onchange="selectTest(this,2)">
										<option value="0" selected="selected">请选择</option>
										<option th:each="item: ${commissionAusAgent}" th:value="${item.id}" th:text="${item.agentName}"></option>
									</select>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">获签国家</span>
									<!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="nationId" id="nationId">
										<option value="0" selected="selected">请选择</option>
										<option th:each="item: ${countryList}" th:value="${item.id}" th:text="${item.countryName}"></option>
									</select>
								</div>
								<div class="input-group col-lg-3" >
									<span class="input-group-addon">学生来源</span>
									<!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="studentSource" id="studentSource">
										<option value="0" selected="selected">请选择</option>
										<option value="1">Walk-in</option>
										<option value="2">Sub-agent</option>
										<option value="3">国内澳际</option>
									</select>
								</div>
								<div class="input-group col-lg-3" >
									<span class="input-group-addon">代理名称</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="agentName" name="agentName"/>
								</div>
							</div>
						</li>
					</ul>

				</div>


				<div class="panel panel-default">
					<!-- Default panel contents -->
					<div class="panel-heading" style="background-color:#6fb3e0"><span  style="margin-left:45% ">佣金信息编辑</span></div>
					<!-- List group -->
					<ul class="list-group BasicInformation">
						<li class="list-group-item">
							<div class="row">
								<input type="hidden" name="schoolName" id="schoolName"/>
								<input type="hidden" name="courseName" id="courseName"/>
								<input type="hidden" name="majorName" id="majorName"/>
								<input type="hidden" name="branch" id="branch"/>
								<input type="hidden" name="ausAgent" id="ausAgent"/>
								<input id = "offerFile" name="offerFile" style="display: none"/>
								<input id = "coeFile" name="coeFile" style="display: none"/>
								<input id = "emailFile" name="emailFile" style="display: none"/>
								<input id="agency_no" name="agencyNo" type="hidden" value="" />
								<input id="agency_name" name="agencyName" type="hidden" value="" />
								<input type="hidden" id="courseProperty" name="courseProperty"/>
								<div class="input-group col-lg-12" style="padding-bottom: 10px;padding-left:2px">
								<div class="input-group col-lg-3">
									<span class="input-group-addon">专业类型</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="collegeType" id="collegeType">
										<option value="0">请选择</option>
										<option value="1">主课</option>
										<option value="2">语言</option>
										<option value="3">预备</option>
										<option value="4">快捷</option>
										<option value="5">夏校</option>
										<option value="6">桥梁</option>
										<option value="7">top up</option>
									</select>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">目标学历</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="educationSection" id="educationSection">
										<option value="0">请选择</option>
										<option value="2">中小学</option>
										<option value="3">本科</option>
										<option value="4">硕士</option>
										<option value="5">博士</option>
										<option value="9">专科</option>
										<option value="10">非学历</option>
										<option value="11">证书</option>
										<option value="12">副学士</option>
									</select>
								</div>
								</div>
								<div class="input-group col-lg-6"  id="testID">
									<span class="input-group-addon" >学校名称</span>
									<select class="col-sm-1 chosen-select" name="collegeId" onchange="commissionSchool()" id="collegeId" data-placeholder="Choose a Country..." style="width:542px;">
										<option value="-1">请选择</option>
										<!--<option th:each="item: ${school}" th:value="${item.id}" th:text="${item.englishName}"></option>-->
									</select>
								</div>
								<div class="input-group col-lg-6" id="agencyNos">
									<span class="input-group-addon" >合作机构</span>
									<!--<input  th:value="${commissionSchool.agencyName}" type="text"  style="display: none"/>-->
									<select class="col-sm-1 chosen-select"  id="agencyNo"  data-placeholder="Choose a SchoolName..." style="width:542px;">
										<option value="-2">请选择</option>
									</select>
								</div>
								<div class="input-group col-lg-6">
									<span class="input-group-addon" >专业名称</span>
									<!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
									<select class="col-sm-1 chosen-select" name="majorId" id="majorIdNew"  data-placeholder="Choose a Country..." style="width:542px;">
										<option value="-1">请选择</option>
									</select>
								</div>
								<div class="input-group col-lg-6">
									<span class="input-group-addon">学位名称</span>
									<select class="col-sm-1 chosen-select" name="courseId" id="courseIdNew"  data-placeholder="Choose a Country..." style="width:542px;">
										<option value="-1">请选择</option>
									</select>
								</div>
								<div class="input-group col-lg-6">
									<span class="input-group-addon">上课校区</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="schoolArea" name="schoolArea"/>
								</div>


								<div class="input-group col-lg-3">
									<span class="input-group-addon" >Paid Fee</span>
									<input type="number" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="paidFee" name="paidFee"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">开课时间</span>
									<input class="form-control" placeholder=" " aria-describedby="basic-addon1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" th:name="startDate" id="startDate"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon" >结课时间</span>
									<input class="form-control" placeholder=" " aria-describedby="basic-addon1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" th:name="endDate" id="endDate"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon" >学校学号</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="schoolNo" name="schoolNo"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">课程周数</span>
									<input type="number" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="studyWeek" name="studyWeek"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">学费</span>
									<input type="number" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="tuition" name="tuition"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon" >学生属性</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="studentProperty" id="studentProperty">
										<option value="0" selected="selected">请选择</option>
										<option value="1">转中介</option>
										<option value="2">打包课程</option>
									</select>
								</div>
								<div class="input-group col-lg-12">
									<span class="input-group-addon">课程属性</span>
									<p type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">
										<label>
											<input type="checkbox" value="1" name="checkchild"/> 新学位
										</label>
										<label>
											<input type="checkbox"  value="2" name="checkchild"/> 转学
										</label>
										<label>
											<input type="checkbox"  value="3" name="checkchild"/> 转专业
										</label>
										<label>
											<input type="checkbox"  value="4" name="checkchild"/> 转课程
										</label>
										<label>
											<input type="checkbox"  value="5" name="checkchild"/> 加读语言
										</label>
										<label>
											<input type="checkbox"  value="6" name="checkchild"/> 填缝
										</label>
										<label>
											<input type="checkbox"  value="7" name="checkchild"/> 延期
										</label>
										<label>
											<input type="checkbox"  value="8" name="checkchild"/> 原打包
										</label>
										<label>
											<input type="checkbox"  value="9" name="checkchild"/> 补课
										</label>
									</p>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">结佣归属</span>
									<!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="commissionBelong" id="commissionBelong">
										<option value="0" selected="selected">请选择</option>
										<option value="1">AEA</option>
										<option value="2">ECIE</option>
										<option value="3">BAEC</option>
									</select>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">佣金比例</span>
									<input type="number" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="schoolRate" name="schoolRate"/>
								</div>

								<div class="input-group col-lg-3">
									<span class="input-group-addon">佣金币种</span>
									<!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="commissionCurrency" id="commissionCurrency">
										<option value="0" selected="selected">请选择</option>
										<option th:each="item: ${currencyInfos}" th:value="${item.id}" th:text="${item.enName}"></option>
									</select>
								</div>

								<div class="input-group col-lg-3">
									<span class="input-group-addon">文签顾问</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="copyOperator" name="copyOperator"/>
								</div>

								<div class="input-group col-lg-3">
									<span class="input-group-addon" >学费币种</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" id="tuitionCurrency" name="tuitionCurrency">
										<option value="0" selected="selected">请选择</option>
										<option th:each="item: ${currencyInfos}" th:value="${item.id}" th:text="${item.enName}"></option>
									</select>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">结佣状态</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="status" id="status">
										<option value="0" selected="selected">请选择</option>
										<option value="1">未开始</option>
										<option value="2">进行中</option>
										<option value="3">已结束</option>
									</select>
								</div>


								<div class="input-group col-lg-3">
									<span class="input-group-addon" >已付学费币种</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" id="paidTuitionCurrency" name="paidTuitionCurrency">
										<option value="0" selected="selected">请选择</option>
										<option th:each="item: ${currencyInfos}" th:value="${item.id}" th:text="${item.enName}"></option>
									</select>
								</div>


								<div class="input-group col-lg-3" >
									<span class="input-group-addon">顾问分支</span>
									<select type="text" class="form-control" aria-describedby="basic-addon1" name="consulterBranch" id="consulterBranch"  onchange="selectTest(this,1)">
										<option value="0" selected="selected">请选择</option>
										<option th:each="item: ${advisers}" th:value="${item.seriano}" th:text="${item.branchName}"></option>
									</select>
								</div>
								<div class="input-group col-lg-3" >
									<span class="input-group-addon">顾问</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="consulter" name="consulter"/>
								</div>
								<div class="input-group col-lg-3">
									<span class="input-group-addon">转接顾问</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="transferConsulter" name="transferConsulter"/>
								</div>

								<div class="input-group col-lg-12">
									<span class="input-group-addon">学生备注</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="studentRemark" name="studentRemark" disabled="disabled"/>
								</div>
								<div class="input-group col-lg-12">
									<span class="input-group-addon">课程备注</span>
									<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1" id="courseRemark" name="courseRemark"/>
								</div>
								<div class="form-inline" style="line-height:38px">
									<div class="col-sm-12">
										<label class="col-sm-2 control-label no-padding-left"><span style="color: red">&nbsp;&nbsp;</span>OfferFile:</label>
										<div class="clearfix">
											<div class="col-sm-8" style="line-height:38px">
												<div class="error">请选择图片上传，支持格式为(jpg, png,gif,jpeg,pdf,doc,docx,eml)，图片最大2M</div>
												<input id="exampleInputFileOffer" name="fileInput" type="file" style="height: 200px"
													   multiple="multiple"/>
											</div>
										</div>
									</div>
								</div>

								<div class="form-inline" style="line-height:38px">
									<div class="col-sm-12">
										<label class="col-sm-2 control-label no-padding-left"><span style="color: red">&nbsp;&nbsp;</span>COEFile:</label>
										<div class="clearfix">
											<div class="col-sm-8" style="line-height:38px">
												<div class="error">请选择图片上传，支持格式为(jpg, png,gif,jpeg,pdf,doc,docx,eml)，图片最大2M</div>
												<input id="exampleInputFileCoe" name="fileInput" type="file" style="height: 200px"
													   multiple="multiple"/>
											</div>
										</div>
									</div>
								</div>

								<div class="form-inline" style="line-height:38px">
									<div class="col-sm-12">
										<label class="col-sm-2 control-label no-padding-left"><span style="color: red">&nbsp;&nbsp;</span>EmailFile:</label>
										<div class="clearfix">
											<div class="col-sm-8" style="line-height:38px">
												<div class="error">请选择图片上传，支持格式为(jpg, png,gif,jpeg,pdf,doc,docx,eml)，图片最大2M</div>
												<input id="exampleInputFileEmail" name="fileInput" type="file" style="height: 200px"
													   multiple="multiple"/>
											</div>
										</div>
									</div>
								</div>

							</div>

						</li>
					</ul>
					<conter>
						<button type="button" class="btn btn-primary" style="left: 50%"  id="submits">保存</button>
						<button type="button" class="btn btn-default"  style="left: 50%" id="calback">取消</button>
					</conter>
				</div>
			</form>
			<!-- /.page-content -->
		</div>

		<div th:include="fragments/bottom::bottom"></div>
	</div>

	<a href="#" id="btn-scroll-up"
	   class="btn-scroll-up btn btn-sm btn-inverse"> <i
			class="icon-double-angle-up icon-only bigger-110"></i>
	</a>
</div>
<!-- /.main-container -->

<!-- Modal备注 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
	 aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content"></div>
	</div>
</div>
<div th:include="fragments/js::js"></div>
<link rel="stylesheet" th:href="@{/assets/fileinput/css/fileinput.min.css}"/>
<link rel="stylesheet" th:href="@{/assets/fileinput/themes/explorer/theme.min.css}"/>
<script  th:src="@{/assets/js/chosen.jquery.min.js}"></script>
<script th:src="@{/My97DatePicker/WdatePicker.js}"></script>
<script th:src="@{/assets/js/jquery.inputlimiter.1.3.1.min.js}"></script>
<script th:src="@{/assets/js/jquery.maskedinput.min.js}"></script>
<script th:src="@{/assets/js/bootstrap-tag.min.js}"></script>
<script th:src="@{/assets/js/ace-elements.min.js}"></script>
<!--<script th:src="@{/assets/js/ace.min.js}"></script>-->
<script th:src="@{/assets/js/jquery.form.js}"></script>
<script th:src="@{/business/invoice/commissionCooperation.js}"></script>
<script th:src="@{/business/common.js}"></script>
<script th:src="@{/business/commission/commissionBranch.js}"></script>
<script th:src="@{/assets/js/jquery.validate.min.js}"></script>
<script th:src="@{/assets/js/jquery.validate.zh-CN.js}"></script>
<!-- page specific plugin scripts -->
<script th:src="@{/assets/js/jquery.dataTables.min.js}"></script>
<!--<script th:src="@{/js/bootstrap.js}"></script>-->
<script th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<script th:src="@{/business/user/user.js}" charset="UTF-8"></script>
<!--图片查看器-->
<script th:src="@{/assets/fileinput/js/fileinput.js}"></script>
<script th:src="@{/assets/fileinput/themes/explorer/theme.js}"></script>
<script th:src="@{/assets/fileinput/js/locales/zh.js}"></script>
<script th:src="@{/assets/fileinput/js/fileinput_geturlTyep.js}"></script>
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
<script type="text/javascript">
    <!--

    //多文件上传及回显
    createFile($('#exampleInputFileOffer'), $("#offerFile"))
    createFile($('#exampleInputFileCoe'), $("#coeFile"))
    createFile($('#exampleInputFileEmail'), $("#emailFile"))

    jQuery(function($) {
        var pageHelper = (function(){
            this.studentNo;
            this.uploadComplete;
            this.postData = function(){
                $("div[flag='template']:hidden").remove();

                if($("#majorIdNew").val() == "" || $("#majorIdNew").val() == '-1'){
                    $("#majorName").val("");
                }
                if($("#courseIdNew").val() == "" || $("#courseIdNew").val() == '-1'){
                    $("#courseName").val("");
                }


                if($("#studentNo").val() == ""){
                    layer.alert("请填写学生学号",{icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }

                if($("#studentNoString").val().indexOf($("#studentNo").val()) != -1){
                    layer.alert('已有此学号,请重新添加!', {icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }
                if($("#collegeId").val() == -1){
                    layer.alert("请填写院校名称",{icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }
                var gstRate = $("#schoolRate").val();
                if(gstRate != "" && gstRate > 1){
                    layer.alert('请输入正确的佣金比例！', {icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }

                if($("#spelling").val() == "" ){
                    layer.alert('请填写拼音！', {icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }
                if($("#collegeType").val() == "" || $("#collegeType").val() == '0'){
                    layer.alert('请填写专业类型！', {icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }

                if($("#agencyNo").val() == "" || $("#agencyNo").val() == '-2'){
                    layer.alert('请填写合作机构！', {icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }

                $.ajax({
                    url: "/commissionManage/save",
                    type: "post",
                    data: $("#edit").serialize(),
                    success: function (data) {
                        if (data) {
                            layer.confirm('操作成功，是否跳转到列表页？', {
                                icon: 1,
                                btn: ['确定'], //按钮
                                btn1: function () {
                                    $("#submits").removeAttr("disabled");
                                    location.href = '/commissionManage/list';
                                }
                            });
                        } else {
                            $("#submits").removeAttr("disabled");
                            $('#alertText').text('操作失败');
                            $('#alert').attr('class', 'alert alert-danger').show();
                            setTimeout("$('#alert').hide()", 2000);
                            $("#myModal").modal("hide");
                        }
                    }
                });
            }

            return{
                init:function(){
                    this.getQueryData();
                    this.handelQueryData();
                    this.render();
                    this.addEvent();
                },
                getQueryData:function(){
                    this.studentNo = GetQueryString("studentNo");
                    this.uploadComplete = true;
                },
                handelQueryData:function(){

                },
                render:function(){
                    var _self = this;
                    $(".chosen-select").chosen();
                    $("div[flag='template']").hide();
                    if ($("#input_isAmerica").val() == "1") {
                        /* 学生留学国家为美国时显示登记完成日期,EVUS附件 */
                        $("#div_evus").show();
                        $("#form_file").show();
                    }
                },
                addEvent:function() {
                    var _self = this;
                    var studentNationName = $("#input_studentNationName").val();
                    $("select[name $='nationId']").change(function () {
                        var index = $("select[name $='collegeId']").index($(this));
                        var select_school = $("select[name $='collegeId']").eq(index);
                        $.post("/commission/getSchool", {"nationId": $("#nationId").val()}, function (data, status) {
                            select_school.empty();
                            select_school.append($("<option value='-1'>请选择</option>"));
                            $.each(data, function (index, item) {
                                select_school.append($("<option value=" + item.id + ">" + item.englishName + "</option>"));
                            });
                            $(".chosen-select").trigger("chosen:updated");
                        });
                    })

                    $("#testID").click(function(){
                        if($("#nationId").val()=="" || $("#nationId").val()=='0'){
                            layer.alert('请填写获签国家！', {icon: 0});
                            return;
                        }
					})
                               $("select[name $='collegeId']").change(function () {
                                   var schoolID = $(this).children("option:selected").val();
                                   var index = $("select[name $='collegeId']").index($(this));
                                   var select_course = $("select[name $='courseId']").eq(index);
                                   var select_major = $("select[name $='majorId']").eq(index);
                                   if (schoolID == "-1") {
                                       select_course.empty().append($("<option value='-1'>请选择</option>"));
                                       select_major.empty().append($("<option value='-1'>请选择</option>"));
                                       select_course.trigger("chosen:updated");
                                       select_major.trigger("chosen:updated");
                                       return;
                                   }
                                   var input_collegeName = $("input[name $='collegeName']").eq(index);
                                   input_collegeName.val($(this).children("option:selected").text());
                                   console.log("collegeId:" + $(this).children("option:selected").val());
                                   console.log("collegeName:" + $(this).children("option:selected").text());
                                   $("#schoolName").val($(this).children("option:selected").text());
                                   var courseType = $("select[name $='collegeType']").eq(index).children("option:selected").val();
                                   var educationSection = $("select[name $='educationSection']").eq(index).children("option:selected").val();
                                   var college = $("select[name $='collegeId']").eq(index).children("option:selected").val();
                                   var majorType;
                                   switch (courseType) {
                                       case "1":majorType = 1;break;
                                       case "2":majorType = 2;break;
                                       case "3":majorType = 3;break;
                                       case "4":majorType = 4;break;
                                       case "5":majorType = 5;break;
                                       case "6":majorType = 6;break;
                                       case "7":majorType = 7;break;
                                   }
                                   if(college!=""&&college!='0') {
                                       if ($("#collegeType").val() != "" && $("#collegeType").val() != '0') {
                                           if ($("#educationSection").val() != "" && $("#educationSection").val() != '0') {
                                               $.post("/visaRecord/getMajor", {
                                                   "schoolID": schoolID,
                                                   "majorType": $("#collegeType").val(),
                                                   "educationSection": educationSection
                                               }, function (data, status) {
                                                   select_course.empty();
                                                   select_course.append($("<option value='-1'>请选择</option>"));
                                                   select_major.empty();
                                                   select_major.append($("<option value='-1'>请选择</option>"));
                                                   $.each(data, function (index, item) {
                                                       select_major.append($("<option value=" + item.id + ">" + item.englishName + "</option>"));
                                                   });
                                                   $(".chosen-select").trigger("chosen:updated");
                                               });
                                           }
                                       }
                                   }
                               });
                    $("select[name $='collegeType']").change(function () {
                        var index = $("select[name $='collegeType']").index($(this));
                        $("select[name $='collegeId']").eq(index).trigger("change");
                    });
                    $("select[name $='educationSection']").change(function () {
                        var index = $("select[name $='educationSection']").index($(this));
                        $("select[name $='collegeId']").eq(index).trigger("change");
                    });
                    $("select[name $='majorId']").change(function () {
                        var index = $("select[name $='majorId']").index($(this));
                        var schoolID = $("select[name $='collegeId']").eq(index).children("option:selected").val();
                        var majorID = $("select[name $='majorId']").eq(index).children("option:selected").val();
                        var select_course = $("select[name $='courseId']").eq(index);
                        if(majorID == "-1"){
                            select_course.empty().append($("<option value='-1'>请选择</option>"));
                            select_course.trigger("chosen:updated");
                            return;
                        }
                        var input_majorName = $("input[name $='majorName']").eq(index);
                        input_majorName.val($(this).children("option:selected").text());
                        console.log("majorId:" + $(this).children("option:selected").val());
                        console.log("majorName:" + $(this).children("option:selected").text());
                        $.post("/visaRecord/getCourse", {"schoolID": schoolID,"majorId":majorID}, function (data, status) {
                            select_course.empty();
                            select_course.append($("<option value='-1'>请选择</option>"));
                            $.each(data, function (index, item) {
                                select_course.append($("<option value=" + item.id + ">" + item.englishName + "</option>"));
                            });
                            $(".chosen-select").trigger("chosen:updated");
                        });
                    });
                    $("select[name $='courseId']").change(function () {
                        var index = $("select[name $='courseId']").index($(this));
                        var input_courseName = $("input[name $='courseName']").eq(index);
                        input_courseName.val($(this).children("option:selected").text());
                        console.log("courseId:" + $(this).children("option:selected").val());
                        console.log("courseName:" + $(this).children("option:selected").text());
                    });
                    $("#submits").click(function () {
                        var number = '';
                        var arr = '';
                        $('input:checkbox[name=checkchild]:checked').each(function(k){
                            if(k == 0){
                                number = $(this).val();
                            }else{
                                number += ','+$(this).val();
                            }
                            if(k == 0){
                                arr = 1 ;
                            } else if(k > 0){
                                arr=number.split(",").length;
                            }else{
                                arr = 0 ;
                            }
                        })
                        $("#courseProperty").val(number);
                        $(this).attr("disabled", "disabled");
                        postData(_self.studentNo);
                    });
                    $("#calback").click(function () {
                        location.href = '/commissionManage/list';
                    });
                    $("input[name $= 'tuition']").each(function () {
                        $(this).keyup(function () {
                            var reg = $(this).val().match(/\d+\.?\d{0,2}/);
                            var txt = '';
                            if (reg != null) {
                                txt = reg[0];
                            }
                            $(this).val(txt);
                        }).change(function () {
                            $(this).keyup();
                        });
                    });
                    $("#a_addCourse").click(function () {
                        $("div[flag='template']:hidden").eq(0).show();
                    });
                    $("button[flag = 'btn_delete']").each(function () {
                        var btn = $(this);
                        btn.click(function () {
                            btn.parent("div").parent("div").hide();
                        });
                    });

                }
            }
        })();
        pageHelper.init();
    });



    -->
</script>
</body>
</html>




